﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="ProMTDesktop"
	type="http://metalx.org/Network/Intel/ProMTDesktop"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:bool="http://metalx.org/i386/Functions/Boolean"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:pcif="http://metalx.org/i386/Functions/Pci"
	xmlns:pci="http://metalx.org/Pc/Pci/Ports"
	xmlns:pcic="http://metalx.org/Pc/Pci/Command"
	xmlns:pcir="http://metalx.org/Pc/Pci/Configuration"
	xmlns:pcis="http://metalx.org/Pc/Pci/Status"
	xmlns:pcn="http://metalx.org/Amd/PcNet/Ports"
	xmlns:pcs="http://metalx.org/Amd/PcNet/ControlStatus"
	xmlns:pcb="http://metalx.org/Amd/PcNet/BusConfiguration"
	xmlns:pcnet="http://metalx.org/i386/Functions/PcNet"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:hex="http://metalx.org/i386/Functions/Hexadecimal"
	xmlns:con="http://metalx.org/i386/Functions/Console"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands">

	<cls:field name="Device" type="http://metalx.org/Pci/PciDevice" offset="0"/>

	<cls:method name="IsNetworkCableConnected" type="http://metalx.org/Boolean">

		<cpu:CopyImmediateToAL/>
		<sbyte>0</sbyte>

		<label id="createObject"/>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetEthernetAddress" type="http://metalx.org/Network/EthernetAddress">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:AddImmediateToAX/>
		<hex>00000014</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<!--Get Memory-->
		<mm:CheckOut length="6"/>

		<cpu:PushDIToStack/>

		<!--Read Address-->
		<cpu:CopyImmediateToAX/>
		<hex>00000001</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddress/>

		<label id="wait"/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:TestALWithImmediate/>
		<binary>00010000</binary>

		<cpu:BranchToRelative8IfZero/>
		<addressOf ref="wait" type="Relative8"/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>16</byte>

		<cpu:CopyALToDIAddressAndIncrementDI/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>8</byte>

		<cpu:CopyALToDIAddressAndIncrementDI/>

		<!--Read Address-->
		<cpu:CopyImmediateToAX/>
		<hex>00000101</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddress/>

		<label id="wait2"/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:TestALWithImmediate/>
		<binary>00010000</binary>

		<cpu:BranchToRelative8IfZero/>
		<addressOf ref="wait2" type="Relative8"/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>16</byte>

		<cpu:CopyALToDIAddressAndIncrementDI/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>8</byte>

		<cpu:CopyALToDIAddressAndIncrementDI/>

		<!--Read Address-->
		<cpu:CopyImmediateToAX/>
		<hex>00000201</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIAddress/>

		<label id="wait3"/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:TestALWithImmediate/>
		<binary>00010000</binary>

		<cpu:BranchToRelative8IfZero/>
		<addressOf ref="wait3" type="Relative8"/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>16</byte>

		<cpu:CopyALToDIAddressAndIncrementDI/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>8</byte>

		<cpu:CopyALToDIAddressAndIncrementDI/>

		<!--Create Address-->
		<sys:GetCatalog/>

		<cpu:CopyImmediateToDI/>
		<addressOf ref="ethernetAddress" type="Absolute32"/>

		<cat:FindType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-BXRegister/>

		<cpu:CopyImmediateToAX/>
		<int>6</int>

		<cpu:PullDIFromStack/>

		<obj:Create/>

		<cpu:ReturnToNearCaller/>

		<var:string id="ethernetAddress">http://metalx.org/Network/EthernetAddress</var:string>
	</cls:method>

	<cls:method name="Enable" type="http://metalx.org/Network/Intel/ProMTDesktop">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="Disable" type="http://metalx.org/Network/Intel/ProMTDesktop">
		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetPacket" type="http://metalx.org/Network/EthernetPacket">
		<sys:GetCatalog/>

		<cpu:CopyImmediateToDI/>
		<addressOf ref="ethernetPacketType" type="Absolute32"/>

		<cat:FindType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-BXRegister/>

		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<cpu:CopyImmediateToDI/>
		<int>0</int>

		<obj:Create/>

		<cpu:ReturnToNearCaller/>

		<var:string id="ethernetPacketType">http://metalx.org/Network/EthernetPacket</var:string>
	</cls:method>

	<cls:method name="GetMissedFrameCount" type="http://metalx.org/Integer">
		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetReceiveCollisionCount" type="http://metalx.org/Integer">
		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<int:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsPacketAvailable" type="http://metalx.org/Boolean">
		<cpu:CopyImmediateToAL/>
		<sbyte>-1</sbyte>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyImmediateToDI/>
		<addressOf ref="deviceName" type="Absolute32"/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>

		<var:string id="deviceName">Intel Pro/1000 MT Desktop</var:string>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class" static="true">
		<cpu:CopyRegisterToOperand/>
		<op:BX-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
</cls:class>